﻿namespace Enter.Utils
{
    public class ResponseData<T>
    {
        public ResponseData() 
        { 
        }
        public ResponseData(string message, bool success = false)
        {
            Success = success;
            Data = default;
            Message = message;
        }
        public ResponseData(T data, string message, bool success = false)
        {
            Success = success;
            Data = data;
            Message = message;
        }
        public bool Success { get; set; }
        public ResponseCommand Command { get; set; }
        public ResponseCode Code { get; set; }
        public T Data { get; set; }
        public string Message { get; set; }
        public string Token { get; set; }

        public static ResponseData<T> OK(string message = "ok.")
        {
            return new ResponseData<T>(message,true);
        }

        public static ResponseData<T> OK(T data, string message = "ok.")
        {
            return new ResponseData<T>(data, message, true);
        }

        public static ResponseData<T> ERROR(string message)
        {
            return new ResponseData<T>(message);
        }
    }

    public enum ResponseCommand
    { 
    }

    public enum ResponseCode
    {
        NotLogin = 10002,
        NotAuthorization = 10003,
    }
}
